#ifndef _TEST_APP
#define _TEST_APP

//INCLUDES
#include <cmath>
#include "ofMain.h"
#include "ofxOpenCv.h"
#include "ofxCvFilter.h"
#include "fpsCounter.h"
#include "console.h"
#include "imageTool.h"
#include "ofxImage.h"

class testApp : public ofBaseApp{

public:
	void setup();
	void update();

	void UpdateAlphaMask();

	inline void minmaxsum( int v, int &smin, int &smax, int &kval );

	void draw();
	void keyPressed  (int key);

private:
	void printFilterInfo(filterProperties prop);
	void printState();
	void drawPreview(ofxImage& content);
	void fillKernelOffsets(int widthStep, int& kernel, int kernelWidth, int kernelHeigth);

	ofxImage drawing;
	ofxImage drawing_gs;
	ofxImage photo;
	ofxImage contour;

	ofxImage* filterTarget;
	void (ofxImage::*nextFilterOP)(int);
	void (ofxImage::*previousFilterOP)(int);
	
	int filterParam;
	
	//Flags
	bool grow;
	bool shrink;
	bool preview;
	bool alphaDirty;
	bool updateAlphaMasking;

	int counter;
	string filterOpName;
	string previousFilterOpName;

	int pixelcount;
	ofImage backgroundResize;
	ofRectangle size;
	ofxCvGrayscaleImage ocvImg;
	ofxCvFilter cvFilter;
	ofxCvFilterkernel kernel;
	fpsCounter fps;
};



#endif


